package cn.com.b2office.service;

import cn.com.b2office.domain.Cart;
import cn.com.b2office.domain.CartItem;

/**
 * some operations with member's shopping cart
 * 
 * @author Administrator
 * 
 */
public interface CartService {

	/**
	 * create a anonymous(have not login) shopping cart
	 * 
	 * @return
	 */
	Cart createAnonymousCart();

	/**
	 * create member's shopping cart
	 * 
	 * @param memberid
	 * @return
	 */
	Cart createCart(String memberid);

	/**
	 * change a anonymous cart to a member's shopping cart after the member
	 * login
	 * 
	 * @param cart
	 * @param memberId
	 */
	void rebuildCart(Cart cart, String memberId);

	/**
	 * add item into member's cart
	 * 
	 * @param cart
	 * @param item
	 * @param qty
	 * @param shape
	 * @param comments
	 */
	void addItemToCart(Cart cart, String itemId, int qty, int shape,
			String comments);

	/**
	 * remove special item from cart
	 * 
	 * @param cart
	 * @param itemId
	 */
	void removeItemFromCart(Cart cart, int cartItemId);
	
	
	void updateCartItemQty(Cart cart,int cartItemId,int qty);

	/**
	 * remove all the cartItems from cart
	 * 
	 * @param cart
	 */
	void clearCart(Cart cart);

	/**
	 * get cartItem object from cart
	 * 
	 * @param cart
	 * @param itemId
	 * @return
	 */
	CartItem getCartItem(Cart cart, int cartItemId);

}
